package tree;

import java.util.ArrayList;
import java.util.List;

/**
 * @ Author     ：侯耀祖
 * @ Description：
 */
public class getMinimumDifference {
    TreeNode pre;
    int min = Integer.MAX_VALUE;
    public int getMinimumDifference(TreeNode root) {
        if (root == null){
            return 0;
        }
        inorder(root);
        return min;
    }
    public void inorder(TreeNode root){
        if (root == null){
            return;
        }
        inorder(root.left);
        if (pre != null){
            min = Math.min(min, root.val - pre.val);
        }
        pre = root;
        inorder(root.right);
    }
}
